package Game.Items.Craft;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.Sound;

import GUI.GuiManager;
import GUI.GuiMessenger;
import Game.GameHelper;
import Game.Buff.DebuffPoison;
import Game.Items.GameItem;
import Game.Objects.GOPlayer;
import Game.Objects.Creatures.GOCreature;
import Screens.MyScreens.GameScreen;
import Tools.Configuration;
import Tools.ResourceManager;
import Tools.SoundManager;
import Tools.Drawing.FontTagSystem;

/** Rat meat class
 * @author Aikidos
 */
public class GIRatMeat extends GameItem {

	// Stats
	private int _hunger = 5;
	
	public GIRatMeat() {
		super("Rat Meat");
		
		Category = ECategory.Potion;
		
		_isStackable = true;
		_weight = 0.07f;
	}

	@Override
	public boolean use() throws SlickException {
		if (_ownerGameObject.isPlayer()) {
			GOPlayer player = (GOPlayer) _ownerGameObject;
			
			player.subHunger(_hunger * 10);
			
			GuiManager.getMessenger().addMessage("[green]You[/green] ate a [yellow]"
					+ getName() + "[/yellow] (-" + String.valueOf(_hunger)
					+ "% hunger)");
			
			// Poisoned?
			if (GameHelper.getRandom().nextInt(100) <= 2) {
				new DebuffPoison(player.getBuffManager());
				
				GuiManager.getMessenger().addMessage("[green]You[/green] poisoned!");
			}
			
			// Play sound
			SoundManager.play("sfx_meat", 0.4f);
			
			return true;
		}
		
		return false;
	}
	
	@Override
	public void drawInfo(Vector2f drawPos, Graphics g) {
		FontTagSystem.drawText("Description:", drawPos);
		
		drawPos.y += 20;
		
		FontTagSystem.drawText("Decreases: [yellow]" 
				+ String.valueOf(_hunger) + "%[/yellow] hunger", drawPos);
	}
	
}
